﻿@using Emoney.UserTraining.Model;
@using Emoney.UserTraining.Comm;
@{
    Layout = null;
}
@{
    var uname = ViewData["uname"].ToString();
    var nettype = ViewData["netType"].ToString();
    var tjLst = (List<Traning_NetworkMeeting>)ViewData["tjLst"];//推荐课程
    var leftLst = (List<Traning_NetworkMeeting>)ViewData["leftLst"];
    var historyLst = (List<VideoEntity>)ViewData["historyLst"];//历史课程
    var uid = ViewBag.uid;
    }

<div class="left">
    @{
    <div id="hidnetType" style="display:none">@nettype</div>
    if(nettype=="2"){
        foreach(var c in leftLst)
        {
            var mtgname = StringTools.SubStr(c.mtg_name, 14);// c.mtg_name.Length > 15 ? c.mtg_name.Substring(0, 15) + "..." : c.mtg_name;
            var txtteachar = StringTools.SubStr(c.txtteachar, 5); //c.txtteachar.Length > 5 ? c.txtteachar.Substring(0, 5) + "..." : c.txtteachar;
            <div class="new" id="newTrain">
			    <div class="tit">最新课程</div>
			    <div class="cont"><span class="fs14 fw">@mtgname</span><br /><div style="height:80px;">@StringTools.SubStr(c.mtg_conent,95)</div><br />
                    <span class="fw">·针对用户</span><br />@StringTools.SubStr(c.user_type,18)
			    </div>
			    <div class="expert">
				    <div class="head"><img style="width:63px; height:63px;" src="@StringTools.GetTeacherImg(c.lecturerImage,63)" /></div>
				    <div class="brief">讲师：<b>@txtteachar</b><br /><span title="@c.txtreateachar">@StringTools.SubStr(c.txtreateachar,34)</span></div>
			    </div>
                <div id="begindate" style="display:none">@c.class_date</div>
			    <div class="time"><div class="t" word-spacing="10"><span class="fs32" id="spanhh">05</span><span id="spantext1">小时</span><span class="fs32" id="spanmm">20</span><span id="spantext2">分</span>后开课</div></div>
			    <div id="divOrder" class="btn">
                    @if(Emoney.UserTraining.Web.Traincom.GetOrderLst(c.Id.ToString(),uname)>0)
                    {
                        <img src="@StringTools.GetStaticFile("Images/Train/images/btn_remind1.jpg")" state="true"/>
                    }
                    else
                    {
                        <a href="#" id="btnOrder" onclick="OrderNetInfo('@c.Id','@mtgname','@c.before_time','@c.mtg_id','@uname','@c.class_date')"><img src="@StringTools.GetStaticFile("Images/Train/images/btn_remind2.jpg")" state="true"/></a>
                    }
			    </div>
                <div id="divBegin" class="btn" style="display:none"><a href="javascript:OpenNetMeeting('@c.mtg_id','@uname','@c.Id')"><img src="@StringTools.GetStaticFile("Images/Train/images/btn10.jpg")" state="true"/></a></div>
		    </div>
            }
    }
    if(nettype=="1")
    {
        foreach(var c in leftLst)
        {
            var mtgname = StringTools.SubStr(c.mtg_name, 14);// c.mtg_name.Length > 15 ? c.mtg_name.Substring(0, 15) + "..." : c.mtg_name;
            var txtteachar = StringTools.SubStr(c.txtteachar, 5); //c.txtteachar.Length > 5 ? c.txtteachar.Substring(0, 5) + "..." : c.txtteachar;
            <div class="new" id="beginTrain">
		    <div class="tit1"></div>
		    <div class="cont"><span class="fs14 fw">@mtgname</span><br /><div style="height:80px;">@StringTools.SubStr(c.mtg_conent,95)</div><br />
                    <span class="fw">·针对用户</span><br />@StringTools.SubStr(c.user_type,18)
		    </div>
		    <div class="expert expert1">
			    <div class="head"><img style="width:63px; height:63px;"  src="@StringTools.GetTeacherImg(c.lecturerImage,63)" /></div>
			    <div class="brief">讲师：<b>@txtteachar</b><br /><span title="@c.txtreateachar">@StringTools.SubStr(c.txtreateachar,34)</span></div>
			    <div class="btn"><a href="javascript:OpenNetMeeting('@c.mtg_id','@uname','@c.Id')"><img src="@StringTools.GetStaticFile("Images/Train/images/btn10.jpg")" state="true"/></a></div>
		    </div>
	    </div>
        }
    }
    if(nettype=="0")
    {
        <div class="notrain" id="noTrain">
		    <div class="text">今日暂无课程安排</div>
            <div class="btn" style="left:0px;"><a href="@Url.Content("~/Train/lstrain?uid="+uid)"><img src="@StringTools.GetStaticFile("Images/Train/images/btn_review.jpg")" alt="回看历史培训" state="true"/></a></div>
	    </div>
    }
    }
    <div class="serv" style="text-align:left;">
    <a href="http://b.qq.com/webc.htm?new=0&sid=4006708688&eid=218808P8z8p8P8K8R8K8p&o=&q=7&from=qqwpa" target="_blank">
        <img src="@StringTools.GetStaticFile("Images/Train/images/btn_qqservice.jpg")" alt="益盟客服" /></a>&nbsp;
    全国服务热线：400-670-8688
    </div>
</div>
<div class="right">
	<div class="rec">
        <div class="tit">推荐课程</div>
        <div class="btn"><a href="@Url.Content("~/Train/alltrain?uid="+uid)"><img src="@StringTools.GetStaticFile("Images/Train/images/btn_plan.jpg")" state="true"/></a></div>
        <div class="cont">
            <div class="tablestyle t1">
                <div class="topheader">
	            <div class="tableitem" style="color:black;">
		            <div class="time">培训时间</div>
		            <div class="theme">主题</div>
		            <div class="name">讲师</div>
	            </div>
            </div>
            @{
                int tjcount = 1;
                var divclass = "";
                foreach(var c in tjLst)
                {
                    if(tjcount%2==0)
                    {
                        divclass = "tableitem bg1";
                    }
                    else
                    {
                        divclass = "tableitem";
                    }
                    string strmtgname = StringTools.SubStr(c.mtg_name, 8);
                    <div class="@divclass">
			            <div class="time2"><b>@string.Format("{0:M/d}", c.class_date) @string.Format("{0:t}", c.class_date)-@string.Format("{0:t}", c.endDate)</b></div>
			            <div class="theme" style="width:108px;" title="@c.mtg_name">@strmtgname</div>
			            <div class="name" title="@c.txtreateachar">@StringTools.SubStr(c.txtteachar,3)</div>
			            <div class="opertion2">
                        @{
                        string rel = StringTools.getTimeIsOpen(c.before_time, c.class_date.ToString(), c.endDate.ToString(), c.Duration_date,c.mtg_id);
                        if (rel == "0")//正在进行
                        { 
                            <a href="javascript:OpenNetMeeting('@c.mtg_id','@uname','@c.Id')"><img src="@StringTools.GetStaticFile("Images/Train/images/btn3.jpg")" state="true"/></a>
                        }
                        else if (rel == "-1")//会议已结束
                        {
                            <a href="@c.video_url" target="_blank" onclick="AddClickCount('videoTip','课程回放','@c.Id')"><img src="@StringTools.GetStaticFile("Images/Train/images/btn2.jpg")" state="true"/></a>
                        }
                        else//会议未开始（开课提醒）
                        {
                            if(Emoney.UserTraining.Web.Traincom.GetOrderLst(c.Id.ToString(),uname)>0)
                            {
                                <img src="@StringTools.GetStaticFile("Images/Train/images/btn16.jpg")"  state="true"/>
                            }
                            else
                            {
                               <a href="#" onclick="OrderNetInfo('@c.Id','@strmtgname','@c.before_time','@c.mtg_id','@uname','@c.class_date')"><img src="@StringTools.GetStaticFile("Images/Train/images/btn15.jpg")" state="true"/></a>
                            }
                        }
                        }
			            </div>
		            </div>
                    tjcount++;
                }
                }
            </div>
        </div>
	</div>
	<div class="his" >
		<div class="tit">历史课程</div>
		<div class="btn"><a target="_blank" href="http://v.emoney.cn/xyvideo/index" onclick="AddClickCount('allHistory','全部历史','')"><img src="@StringTools.GetStaticFile("Images/Train/images/btn1.jpg")" state="true"/></a></div>
		<div class="cont">
			<div class="tablestyle t1">
				<div class="topheader">
					<div class="tableitem" style="color:black;">
						<div class="theme3">主题</div>
						<div class="name">讲师</div>
						<div class="number">观看人数</div>
					</div>
				</div>
                @{
                    int lscount = 1;
                    var divclassls = "";
                    foreach (var c in historyLst)
                    {
                        if (lscount % 2 == 0)
                        {
                            divclassls = "tableitem bg1";
                        }
                        else{
                            divclassls = "tableitem";
                        }
                                
                        <div class="@divclassls">
							<div class="theme3">@StringTools.SubStr(c.title,12)</div>
							<div class="name">@c.author</div>
							<div class="number figure">@c.ClickCount</div>
							<div class="opertion2"><a href="http://v.emoney.cn/xyvideo/video?id=@c.id" onclick="AddClickCount('videoTip_xy','学院课程回放','@c.id')" target="_blank"><img src="@StringTools.GetStaticFile("Images/Train/images/btn2.jpg")" state="true"/></a></div>
						</div>
                        lscount++;
                    }
                    }
			</div>
		</div>
	</div>
     <div class="serv" style="text-align:right;">
        <a href="http://www.emoney.cn/mini2/mini/2013幸福中国投资宝典.rar" id="btndownfile"><span style="color:red; font-weight:600; text-decoration:underline">《2013幸福中国投资宝典第一期》下载</span></a>
    </div>
</div>
<script>
    $(document).ready(function () {
        var nettype = "@nettype";
        if (nettype == "2") {
            GetRTime();
        }
    });
    
    var year, month, day, hour, m;
    var EndTime;
    function GetRTime() {
        var b = new Date($("#begindate").html());
        year = b.getFullYear();
        month = b.getMonth();
        day = b.getDate();
        hour = b.getHours();
        m = b.getMinutes();
        EndTime = new Date(year, month, day, hour, m); 
        var NowTime = new Date();
        var nMS = EndTime.getTime() - NowTime.getTime();
        var nD = Math.floor(nMS / (1000 * 60 * 60 * 24));
        var nH = Math.floor(nMS / (1000 * 60 * 60)) % 24;
        var nM = Math.floor(nMS / (1000 * 60)) % 60;
        var nS = Math.floor(nMS / 1000) % 60;
        
        if (nMS >= 0) {
            if (nD > 0) {
                $("#spanhh").html(nD);
                if (nH > 0) {
                    $("#spanmm").html(nH);
                    $("#spantext2").html("小时");
                }
                else {
                    $("#spanmm").html(nM);
                    $("#spantext2").html("分");
                }
                $("#spantext1").html("天");
            }
            else {
                $("#spanhh").html(nH);
                $("#spanmm").html(nM);
                $("#spantext1").html("小时");
                $("#spantext2").html("分");
            }
            setTimeout("GetRTime()", 1000);
        }
        else {
            $("#divBegin").show();
            $("#divOrder").hide();
        }
    }
   
</script>
<script>
    function setImgUrl(imgString, rStr) {
        var Result = new Array(4)
        , imgUrl = imgString;
        Result[0] = imgUrl.replace(/((.*)\/)(.*)(\.[a-zA-z]{3,5})$/, '$1');
        Result[1] = imgUrl.replace(/((.*)\/)(.*)(\.[a-zA-z]{3,5})$/, '$3');
        Result[2] = Result[1].replace(/((_over)|(_click))/, "");
        Result[3] = imgUrl.replace(/((.*)\/)(.*)(\.[a-zA-z]{3,4})$/, '$4');
        return Result[0] + Result[2] + rStr + Result[3];
    }

    $("[state=true]").mouseenter(function () {
        $(this).attr("src", setImgUrl($(this).attr("src"), "_over"));
    }).mouseleave(function () {
        $(this).attr("src", setImgUrl($(this).attr("src"), ""));
    }).mousedown(function (e) {
        $(this).attr("src", setImgUrl($(this).attr("src"), "_click"));
    }).mouseup(function (e) {
        $(this).attr("src", setImgUrl($(this).attr("src"), "_over"));
    });
</script>
